<%-- 
    Document   : savedata
    Created on : 03 14, 14, 11:50:25 PM
    Author     : Theodoro
--%>

<%@page contentType="text/html" language="JAVA" pageEncoding="UTF-8" errorPage="error.jsp"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page import="java.sql.*,java.text.*" %>
<sql:setDataSource user="root" password="" driver="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost/bonix"/>

<sql:update>
    INSERT INTO contracts(cust,servp,date,description) VALUES('<%=request.getParameter("cust")%>', 
    '<%=session.getAttribute("username")%>', 
    '<%=request.getParameter("scheduledDate")%>', 
    '<%=request.getParameter("description")%>')

</sql:update>
<c:if test="${param.source == 'home'}">
    <c:redirect url="home.jsp"/>  
</c:if> 
<c:if test="${param.source == 'clients'}">
    <c:redirect url="clients.jsp"/>  
</c:if>  
<c:if test="${param.source == 'viewConversation'}">
    <c:url var="returnURL2" value="viewConversation.jsp">
        <c:param name="sender" value="${sessionScope.sender}" />
    </c:url>
    <c:redirect url="${returnURL2}"/>  
</c:if>   
